package com.qfoud.edu.dbutils.framwork.result.impl;

import com.qfoud.edu.dbutils.framwork.result.base.ResultSetHandler;
import com.qfoud.edu.dbutils.framwork.result.base.RowProcessor;

import java.sql.ResultSet;

/**
 * @author xiaobobo
 * @title: BeanArrayHandler
 * @projectName cd-java-2303-project-parent
 * @description: 这个返回的是一列数据的数组
 * @date 2023/5/11  10:08
 */
public class BeanArrayHandler<T> implements ResultSetHandler<T[]> {

    //行处理器
    private RowProcessor rowProcessor;

    private Class clazz;

    public BeanArrayHandler(Class clazz,RowProcessor rowProcessor){
        this.clazz=clazz;
        this.rowProcessor=rowProcessor;
    }

    public T[] handler(ResultSet resultSet) throws Exception {
        return (T[]) rowProcessor.handler(resultSet);
    }
}
